#include "smallwidget.h"
#include "ui_smallwidget.h"

SmallWidget::SmallWidget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::SmallWidget)
{
    ui->setupUi(this);

    //spinbox改变，Slider也改变
    void(QSpinBox:: *spSig)(int)=&QSpinBox::valueChanged;//有重载版
    connect(ui->spinBox,spSig,ui->horizontalSlider,&QSlider::setValue);

    //Slider改变，spinbox也改变
    connect(ui->horizontalSlider,&QSlider::valueChanged,ui->spinBox,&QSpinBox::setValue);
}


//设置固定数值
void SmallWidget::setVal(int val)
{
    ui->spinBox->setValue(val);
}
//获取值
int SmallWidget::getVal()
{
    return ui->spinBox->value();
}
SmallWidget::~SmallWidget()
{
    delete ui;
}
